home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / EDITORS / ZAP130 / !Zap / Docs / E-Zapcalls < prev    next >
Text File  |  1995-06-19  |  46KB  |  1,093 lines

  1. *************************************************************************
  2. * >E-ZapCalls    Documentation of Zap entry points (how to call Zap)    *
  3. *************************************************************************
  4.  
  5. Zap does NOT have a SWI interface as it uses registers R8-R10 to point to
  6. data blocks, and these cannot be passed to swi's. To call Zap you will need
  7. to know the address of the Zap module workspace (ie it's private word). If
  8. you are an extension mode then this will be passed to you in R12 whenever you
  9. are called by one of your entry points. However, for the first call you make
  10. to Zap, when you add your module to it's list via Zap_Addmode, you will not
  11. know it. Then you should use OS_Module 18 to find it. Eg,
  12.  
  13.  SYS "XOS_Module",18,"Zap" TO R0,R1,R2,R3,workspace%
  14.  
  15. Now, the first word in Zap's workspace contains the address of a table of
  16. Zap's entry points. Thus to call the entry point (documented below) at offset
  17. a% I suggest you use the basic macro given below.
  18.  
  19.     REM Call Zap at entry offset a%
  20.     REM Entry: R0-R11=args R12=zap workspace
  21.     REM Exit : R0-R11=returned values R12 preserved R14 corrupted
  22.     
  23.     DEF FNcall(a%)
  24.     [OPTpass
  25.     LDR R14,[R12]        \ get start of zap table
  26.     ADD R14,R14,#a%        \ address of the sub
  27.     STMFD R13!,{R14}        \ save address on stack
  28.     MOV R14,PC            \ return address (with flags)
  29.     LDMFD R13!,{PC}        \ call the sub 
  30.     ]:=""
  31.  
  32. The names of the routines are listed below in the order in which they appear
  33. in the table. Thus the first, Zap_AddMode, is at offset 0. The second,
  34. Zap_Claim is at offset 4, etc. These values are defined for you in the
  35. program E-Library.
  36.  
  37. In general these routines have the following entry/exit conditions:
  38.  
  39.  \E R0-R11=arguments R12=Zap's workspace R13=user stack R14=return address
  40.  \X R1-R13 preserved. R0 and Flags ALTERED. V set if error and R0=error block
  41.  
  42. Thus if I write:
  43.  
  44.  \E R8
  45.  \X R1=3
  46.  
  47. Then I mean that on entry R8 was the window block pointer, R12 zap's
  48. workspace etc. And on exit that R1=3, R2-R13 saved, R0 corrupted etc. If I
  49. omit the \E or \X then I mean the standard entry/exit conditions hold.
  50.  
  51. Errors should be passed back to Zap by the entry point through which the
  52. module was called (with V flag set and R0=error block pointer). Please note
  53. that for most calls, Zap must be paged in as the current task! This will be
  54. so if you are an extension mode.
  55.  
  56. For a table/summary of the zap call names for including in your source, see
  57. the file E-Library.
  58.  
  59. Zap_AddMode
  60. Adds a new Zap extension mode. This should be called after the module Zap is
  61. loaded, but before it starts up as a new task. Zap need not be paged in for
  62. this call.
  63.     \E R0=address of table of entry points (see file E-Entry)
  64.  
  65. Zap_Claim
  66. Claims a block of workspace in Zap's heap.
  67.     \E R0=number of bytes required
  68.     \X R0=pointer to the heap block
  69.  
  70. Zap_Ensure
  71. Ensures a zap heap block is of a given size.
  72.     \E R0=pointer to the heap block
  73.        R1=number of bytes required.
  74.     \X R0=new heap block pointer of (possibly moved) extended block.
  75.        (An error is returned if the block couldn't be enlarged).
  76.  
  77. Zap_Free
  78. Free a zap heap block after use.
  79.     \E R0=pointer to heap block to free
  80.  
  81. Zap_MoveBytes
  82. Moves a block of memory. The movement may be up or down by any amount. The
  83. data is ALWAYS preserved no matter where the destination is. This routine is
  84. highly optimised and should be used for moving any large block of data. Zap
  85. need not be paged in.
  86.     \E R1=source byte address
  87.        R2=destination byte address
  88.        R3=number of bytes to move
  89.     \X R1-R3 corrupted
  90.  
  91. Zap_SplitBuffer
  92. This splits a file held in Zap at the indicated file offset ready for
  93. insertion/deletion of data. It also ensures that file buffer has a given
  94. amount of room free. See E-File.
  95.     \E R0=file offset to split at (new value for f_splito)
  96.        R1=minimum number of bytes to have free in the split
  97.        R9=file to be split
  98.  
  99. Zap_NewTxtStatus
  100. This updates the screen after changes are made to a file. This is very low
  101. level and you should use Zap_Command when possible. Zap_SaveTxtStatus should
  102. be called first.
  103.     \E R0/R1 as for SaveTxtStatus and R2=new input caret offset.
  104.  
  105. Zap_SaveTxtStatus
  106. This is a low level call used by Zap_DoCommand when changing a file. You
  107. should use Zap_Command/Zap_DoCommand in preference. Any file changes done
  108. using this call are NOT saved in the undo buffer. Ie, don't use it. To use it
  109. you specify the area of the file to be changed (R0 to R2) and the amount of
  110. the change (in R1). After making the change you use Zap_NewTxtStatus to
  111. update the screen. Set f_docom to 0 if in doubt.
  112.     \E R0=file offset of first byte in file to be changed.
  113.        R1=proposed signed change in size of file.
  114.        R2=file offset of first character which is unchanged.
  115.        f_docom,f_dolen,f_dodata must be set up - see e_prevline.
  116.  
  117. Zap_Command
  118. This should be used for inserting/deleting/replacing data in a file. Its 
  119. action is to call the mode entry point named e_command. See E-Entry. The
  120. mode's default action is then to call Zap_DoCommand. The commands are
  121. automatically placed in the undo buffer. If you are doing a sequence of
  122. insertions/deletions then please use Zap_Start/StopOp. Note that the cursor
  123. is automatically updated to the end of the inserted/deleted region. To
  124. prevent this, set b14 of f_flags, but you MUST restore it after the command
  125. returns.
  126.     \E R0=command number: 1=insert 2=delete 3=replace (forward)
  127.         4=replace (backward). Add &10 if command is to be buffered
  128.         in one block (and thus undone in one key press).
  129.        R1=file offset for command to take place at.
  130.        R2=number of bytes being inserted/deleted/replaced.
  131.        R3=data to insert/replace with for commands 1,3,4.
  132.        R8=window on file to be altered/0 if none.
  133.        R9=file to be altered.
  134.     NB If you don't specify the window then it won't know which mode to
  135.     call, so this command will just call Zap_DoCommand.
  136.  
  137. Zap_NewWinStatus
  138. This recreates a window after some display parameters have changed. Use
  139. Zap_SaveWinStatus before changing any parameters.
  140.     \E R8/R9
  141.     
  142. Zap_SaveWinStatus
  143. This is used before changing any of the 'w_*' window parameters which would
  144. effect the display. See E-Window. The current cursor position, scroll offsets
  145. etc are saved. After changing the window parameters call Zap_NewWinStatus.
  146. Zap will do it's best to recreate the window with the new attributes,
  147. preserving the position of the cursor on screen.
  148.     \E R8/R9
  149.  
  150. Zap_ReplaceArea
  151. This command replaces one area of text with another (not necessarily of the
  152. same length) by performing the minimum number of insertions/deletions/simple
  153. replaces using Zap_Command. In BASIC mode it also retokenises the line as
  154. necessary. This is used during a search and replace. See mode entry point
  155. e_replace.
  156.     \E R1=file offset of original data
  157.        R2=length of original data
  158.        R3=address of replacement data
  159.        R4=length of replacement data R8/R9
  160.        
  161. Zap_PlotCaret
  162. This command plots a caret in its new position automatically removing it from
  163. its old position. Ie, it just calls Zap_ClearCaret then Zap_SetCaret.
  164.     \E R10=caret block
  165.  
  166. Zap_ReflectCaret
  167. This acts as Zap_PlotCaret but only uses c_off, updating the c_loff and c_col
  168. offsets from this. Ie, it just calls Zap_UpdateCaret then Zap_PlotCaret.
  169.     \E R10=caret block
  170.  
  171. Zap_SetCaret
  172. This updates the area of the window containing the the caret given on entry.
  173. Hence it's effect is usually to draw the caret at it's (new) position. See
  174. E-Cursors.
  175.     \E R10=caret block
  176.  
  177. Zap_ClearCaret
  178. As for Zap_SetCaret, but it updates the area of the window where the caret
  179. last was (stored in the c_o* variables). Hence the caret is in effect removed
  180. from its old position. See E-Cursors.
  181.     \E R10=caret block
  182.  
  183. Zap_DoCommand
  184. This acts as Zap_Command but actually performs the action rather than
  185. calling the extension mode.
  186.     \E As for Zap_Command.
  187.  
  188. Zap_ShowCursor
  189. This call makes sure that a given cursor can be seen in its window (by
  190. changing the scroll offsets if necessary). It does not redraw the cursor
  191. in general (though changing the scroll offsets may cause it to be redrawn).
  192.     \E R10=cursor block of cursor to show
  193.  
  194. Zap_ReadVar
  195. Reads one of Zaps internal variables. See the file E-Vars for the numbers.
  196.     \E R1=variable number.
  197.     \X R0=variable value.
  198.  
  199. Zap_WriteVar
  200. Writes one of zaps internal variables. See the file E-Vars for the numbers.
  201.     \E R1=variable number
  202.        R0=new value
  203.  
  204. Zap_SaveFile
  205. This saves a file to disc (using f_name as the file name). The file may not
  206. actually be saved if a dialogue box is opened. (Eg: 'file is older than
  207. version on disc box'). Please note the value of R0 on exit!
  208.     \E R8/R9 = window to save
  209.     \X R0=0  => File has been saved to disc - you can now delete it.
  210.        R0=-1 => File has not yet been saved - warning window opened /
  211.                data transfer initiated.
  212.  
  213. Zap_FillWords
  214. Fast word filling code. The block must be word aligned. Zap need not be paged
  215. in.
  216.     \E R1=word to fill with.
  217.        R2=address of memory to fill (word aligned).
  218.        R3=number of bytes to fill (a multiple of 4).
  219.     \X R0-R3 corrupted.
  220.  
  221. Zap_UpdateLns
  222. This updates the line numbers column of a given window. This is usually done
  223. automatically by Zap_Command. This is used by the BASIC mode on a renumber.
  224.     \E R0=first physical line to start from R8/R9
  225.  
  226. Zap_EachWindow
  227. This sub calls a given sub for each window on a given file. Each time it
  228. calls the sub pointed to in R10, it sets up R8 for that window.
  229.     \E R0-R7=args to pass to the sub.
  230.        R9=file (whose windows you are to call).
  231.        R10=address of sub to call for each window on this file.
  232.     The sub called has:
  233.         \E R0-R7 as set up by you
  234.            R8/R9 points to the given window
  235.         \X Must preserve R1-R11 and VS on error etc.
  236.  
  237. Zap_UpdateCaret
  238. This sub is called to update a caret position from a given file offset. Save
  239. the new offset of the caret in c_off. Call this. Then c_col, c_line, c_loff,
  240. c_width will be set up. See E-Cursors.
  241.     \E R10=caret block
  242.  
  243. Zap_GetWindState
  244. Updates the window block R8 (first few entries) by calling
  245. Wimp_GetWindowState.
  246.     \E R8
  247.  
  248. Zap_StartOp
  249. Starts a sequence of operations. This should be used when performing a
  250. sequence of calls to Zap_Command. It causes all the file changes to be made
  251. with only ONE screen refresh, thus giving a much smoother update. After this
  252. has been called, all subsequent calls to Zap_Command before a Zap_StopOp call
  253. have their actions concatenated. When you call Zap_StopOp the screen is then
  254. updated. You MUST call Zap_StopOp before returning to Wimp_Poll. StartOp/
  255. StopOp's can be nested to any depth (so only the last StopOp actually causes
  256. the screen to be updated).
  257.     \E R9=file which will be operated on.
  258.  
  259. Zap_StopOp
  260. Ends a StartOp/StopOp structure.
  261.     \E R9=file which has been operated on.
  262.     \X If VC on entry then R0 corrupted and R1-R11 preserved as usual.
  263.        If VS on entry then error pointer in R0 and V flag status are
  264.        also preserved.
  265.  
  266. Zap_CallMode
  267. Calls a mode entry point. See E-Entry for a list of entry points. The mode
  268. called is the mode of the window given in R8.
  269.     \E R0-R10=parameters R8 R11=mode entry point offset
  270.     \X As for the given mode entry point.
  271.  
  272. Zap_CallGivenMode
  273. Calls a mode entry point of a specified mode.
  274.     \E R0-R9=parameters R10=mode number R11=entry point offset
  275.     \X As for the given mode entry point.
  276.  
  277. Zap_ReadMode
  278. Read the address of the mode entry point tables. Two pointers are returned.
  279. The first (R0) is a pointer to the mode table as stored in the extension
  280. module and documented in E-Entry. The second (R1) points to a table of actual
  281. addresses to be called, with entry points which were null in the original
  282. table converted to addresses and all offsets converted to addresses. In this
  283. table, each entry consists of 8 bytes. The first 4 bytes gives the address of
  284. the entry point, and the next 4 the value to pass in R11 when the entry point
  285. is called. This will obviously vary if some mode entry points are based on
  286. other modes. Thus the linked table has the form:
  287.     e_module    #0    module address,    module workspace address
  288.     e_title        #8    title address,    undefined
  289.     e_author    #16    author address,    undefined
  290.     e_basemode    #24    basemode,    undefined
  291.     e_mode        #32    mode number,    undefined
  292.     e_init        #40    init code addr,    value to pass in R11
  293.     e_menu        #48    wimp menu data,    undefined
  294.     e_len        #56    undefined,    undefined
  295.     e_postload    #64    postload addr,    value to pass in R11
  296.      and the rest as for e_postload.
  297. I reserved the right to use the undefined words in future. You can change the
  298. table entries pointer to in R1, but I don't advise it :-)
  299.     \E R0=mode number.
  300.     \X R0=pointer to unlinked table in modes module / <=0 if invalid
  301.        R1=pointer to linked table in zaps workspace / <=0 if invalid
  302.  
  303. Zap_FindFile
  304. Given the name of a file, this call produces a window on that file (loading
  305. it if necessary). Path is canonicalised before comparing with currently
  306. loaded files.
  307.     \E R0=file name.
  308.     \X R8/R9=window on that file.
  309.  
  310. Zap_FindWindow
  311. Given a file block pointer of a file already loaded, this call produces a
  312. window block pointer of a window on that file (opening it if necessary).
  313.     \E R9
  314.     \X R8
  315.  
  316. Zap_ConvWindOff
  317. Converts a window offset to a window block pointer. See E-Windows.
  318.     \E R0=offset of a window in the window list /-ve
  319.     \X R8/R9=window and file /0
  320.  
  321. Zap_ConvFileOff
  322. Converts a file offset to a file block pointer. See E-File.
  323.     \E R0=offset of a file in the file list/-ve
  324.     \X R9=pointers to the file block/0
  325.  
  326. Zap_GetWindOff
  327. Converts a window block pointer to a window offset. See E-Windows.
  328.     \E R8=window block pointer/0
  329.     \X R0=offset in the window list/-ve
  330.  
  331. Zap_GetFileOff
  332. Converts a file block pointer to a file offset. See E-File.
  333.     \E R9=file block pointer/0
  334.     \X R0=offset in the file list/-ve
  335.  
  336. Zap_GotoOffset
  337. This call causes the given cursor to jump to a given file offset, leaving a
  338. mark behind at the previous position.
  339.     \E R0=offset to go to R8-R9=file R10=cursor
  340.  
  341. Zap_JumptoOffset
  342. As for GotoOffset but no mark left on jumping.
  343.     \E R0=offset to go to R8-R9=file R10=cursor
  344.  
  345. Zap_FindOffset
  346. Given the (x,y) position in work area characters, finds the file offset of
  347. the 'nearest' point in the file. See E-Windows.
  348.     \E R2=x column (inc margin) R3=y row (from top)
  349.     \X R0=file offset R1=file offset of physical line start R2/R3 clipped
  350.  
  351. Zap_NewFileTitle
  352. Update the titlebars of all windows on a given file.
  353.     \E R9=file
  354.  
  355. Zap_InsertString
  356. Inserts a string at the end of a buffer using Zap_Command.
  357.     \E R0=zero terminated string R8/R9
  358.  
  359. Zap_CreateFile
  360. Creates an empty file, possibly changing the opt_flags/format via BIC 'mask'
  361. EOR 'eor' when creating it. See E-Flags, E-Windows. It calls
  362. Zap_CreateWindBlock and Zap_CreateFileBlock etc.
  363.     \E R0=file type
  364.        R1=flags mask
  365.        R2=flags eor
  366.        R3=format mask
  367.        R4=format eor
  368.     \X R8/R9=newly created file (with open window).
  369.  
  370. Zap_NewLinkEntry
  371. Adds a new link entry to the f_links list. See E-File for description of the
  372. links list format. This is a low-level call. Use Zap_Throwback in preference.
  373. This is used by throwback. A new block is created if the file name does not
  374. match that of the previous link block, or the flags differ. The point of the
  375. links is that they are updated when changes are made to the indicated file.
  376.     \E R0=data word (Ie file offset of link / line number of link
  377.           depending on flags in R5).
  378.        R1=filename (Of the file that R0 is an offset in).
  379.        R4=file offset/-1 (Ie, offset in file list of the file named in
  380.            R1 if the file is loaded, or -1 if you don't know if the file
  381.            is loaded or not - usually safest to put as -1).
  382.        R5=flags (as documented under f_links in E-File).
  383.        R9=file to which the link should be added - ie this is the
  384.           throwback buffer file as opposed to R1 which is the file giving
  385.           the C program / file which was searched through.
  386.     \X R0=0 if link added to last list entry/1 if new entry created.
  387.  
  388. Zap_DefaultClick
  389. Calls the default mouse click handling code. See the entry point e_click.
  390.     \E R1=depth (0=drag 1=click 2=double click etc)
  391.        R2=x R3=y
  392.        R4=buttons
  393.        R8/R9 as for e_click.
  394.  
  395. Zap_PutCaret
  396. Sets standard cursor editing mode and puts the cursor caret at a given file
  397. offset in a given file.
  398.     \E R0=file offset R8/R9=file
  399.  
  400. Zap_DiscardFile
  401. Kill a file and all windows on that file without prompting user.
  402.     \E R9=file
  403.  
  404. Zap_DeleteFile
  405. As for Zap_DiscardFile but prompts user if file altered etc.
  406.     \E R9=file
  407.  
  408. Zap_DiscardWindow
  409. Kill a window, and the file if auto-delete is on and this is the last window
  410. on that file. Don't prompt user.
  411.     \E R8/R9
  412.  
  413. Zap_DeleteWindow
  414. As for Zap_DiscardWindow but prompts user if file altered etc.
  415.     \E R8/R9
  416.  
  417. Zap_BuildMenu
  418. This is zaps 'variable length menu' building sub. See E-Menu for details on
  419. Zap's menu format.
  420.     \E R0=menu name (max 12 chars)
  421.        R1=address of sub to generate the menu entries
  422.        R2=address of menu updating sub/0 if none (see E-Menu)
  423.        R3=address of menu interpret sub for all entries/0 (see E-Menu)
  424.        R4=menu width in chars
  425.        R8-R11=values to call the sub in R1 with on the first call.
  426.     \X R0=pointer to wimp menu structure
  427.     The sub passed in R1 has the following conditions:
  428.          \E R0=buffer for you to put the next menu entry in (48 bytes)
  429.         R5=address of menu structure start }
  430.         R6=address of current menu entry   } you don't need these
  431.         R7=address of current buf entry    }
  432.         R8-R11=as returned from last call
  433.          \X R0=index for this entry/-1 if no more entries (see E-Menu)
  434.              R1-R7 saved
  435.              R8-R11=updated (ie for your own use).
  436.  
  437. Zap_ClearSel
  438. Clears currently selected area.
  439.  
  440. Zap_CreateFileBlock
  441. Creates a new file block with currently configured options. f_ptr etc are set
  442. up for you. See E-File. Use Zap_Install file to load a file.
  443.     \E R0=size to make buffer
  444.        R1=filename of buffer
  445.        R2/R3=load/exec
  446.     \X R9=new file block (with file filled with rubbish).
  447.     
  448. Zap_CreateWindBlk
  449. Creates a new window block with currently configured options. Window is
  450. opened on the screen etc.
  451.     \E R9=file window is to be on.
  452.     \X R8=New window on this file.
  453.        R0=Block of info on the mode used (see Zap_WhichMode).
  454.     
  455. Zap_GetSel
  456. Find out what area is selected.
  457.     \X If CS then no valid selection
  458.        If CC then R1=file offset R2=selection length R8/R9=file
  459.  
  460. Zap_InsertMark
  461. Insert a marker.
  462.     \E R0=file offset of mark R8/R9
  463.  
  464. Zap_InstallFile
  465. Load a file into zap.
  466.     \E R0=filename
  467.     \X R0=window offset of created window / -1 if not loaded.
  468.  
  469. Zap_NewMode
  470. Change the display mode of a window.
  471.     \E R0=new mode number R8/R9 (R8=0 to change options mode)
  472.  
  473. Zap_NewTitle
  474. Update the titlebar on a given window. See also Zap_NewFileTitle.
  475.     \E R8/R9
  476.  
  477. Zap_CallBaseMode
  478. DO NOT USE THIS. This call is now obsolete. Use the call Zap_BaseMode
  479. instead. If you use this call it will appear to work perfectly until someone
  480. tries to use your mode as a base mode. When this happens an infinite loop
  481. occurs which I can't fix. The docs are kept for backwards compatibility.
  482. --------------------------------------------------------------------------
  483. As for Zap_CallMode except it calls the base mode instead. The window in R8
  484. identifies the current mode. The entry point called is that of the base mode
  485. associated to this current mode. Hence, it would be used by a mode to call
  486. a base mode entry point which the current mode has redefined.
  487.     \E R0-R10=parameters R8 R11=mode entry point offset (see E-Entry)
  488.     \X As for the given mode entry point.
  489.  
  490. Zap_NewView
  491. As for Zap_CreateWindBlk but 'clones' a given window image. The cursor is not
  492. put in the window.
  493.     \E R8/R9=window to clone from (R8=0 then don't clone)
  494.  
  495. Zap_ReadSel
  496. Reads the currently selected region into a heap block. You must free the heap
  497. block when you have finished with the selection.
  498.     \X R3=heap block with data and R2=length / R3=0 if no selection
  499.  
  500. Zap_Replace
  501. Calls the Zap file search and replace code using the current search string
  502. and current replace string.
  503.     \E R1=0 for selective/1 for global
  504.        R3=start offset in file
  505.        R4=direction (+1/-1)
  506.        R5=search flags (as for Zap_Search)
  507.        R8/R9=current window
  508.  
  509. Zap_Search
  510. Calls the Zap wildcard search code.
  511.  \E R0=pointer to search string
  512.     R1=output 0=to cursor 1=to buffer 2=no output
  513.        OR &100+offset of throwback window to add search matches to.
  514.     R3=start offset of the search (in the file)
  515.        (NB The first offset actually tested is R3+R4 so use R3=-1 to search
  516.         from the start of the file).
  517.     R4=search direction +1/-1
  518.     R5=search flags b31=set for a raw search (don't search by lines)
  519.             b30=set if case sensitive
  520.             b29=set if macros shouldn't be expanded
  521.             b28=set if \commands should be ignored (and `s etc)
  522.             b27=set to search all windows (move to next one after)
  523.             b26=don't update hourglass in search_text
  524.             b25=don't beep if no match found
  525.             b24=return end of match offset in R1 (if one found)
  526.     R8/R9=current window of search
  527.  \X If R1=0 or 1 then output displayed
  528.     If R1=0 or 2 then R0=match offset on exit / -ve if none
  529.     If R1=1 then R0=offset of throwback window / -ve if none
  530.     R1=offset of end of match (if b24 of R5)
  531.  
  532. Zap_Select
  533. Selects a given region, and puts carets back to default mode.
  534.     \E R2=start offset R3=end offset R8/R9
  535.  
  536. Zap_AlterSel
  537. As for Zap_Select but doesn't restore caret modes.
  538.     \E R2=start offset R3=end offset R8/R9
  539.  
  540. Zap_OffLineCol
  541. Converts a file offset to and x,y coordinate in the window work area. See
  542. also Zap_FindOffset. See E-Windows.
  543.     \E R0=file offset R8/R9
  544.     \X R0=start of line offset
  545.        R2=column (inc margin)
  546.        R3=row
  547.  
  548. Zap_AddCommands
  549. Adds a table of commands to zap's list. Zap can currently cope with up to 16
  550. tables of commands. This should be called when a module initialises as for
  551. Zap_AddMode. Zap need not be mapped into memory for this call. See E-Commands
  552. for the table format.
  553.     \E R0=address of command table (R12=Zaps workspace).
  554.     
  555. Zap_MiniWrite
  556. This call sends a stream of characters to the minibuffer. The minibuffer
  557. contents is changed but not updated on screen. However, if this call is used
  558. within a command, then the minibuffer will updated on screen automatically
  559. by Zap. Use Zap_MiniUpdate to force an update, but you shouldn't have to use
  560. this. The minibuffer takes the form:
  561.     <prompt string><mark><user editable field>.
  562. The user cannot move the cursor before the 'invisible' mark. The string
  563. passed to Zap_MiniWrite may contain the following control codes:
  564.     0=string terminator
  565.     1=move cursor to mark (ctrl a)
  566.     2=8=move cursor back one character (ctrl b)
  567.     4=delete character after cursor (ctrl d)
  568.     5=move to end of string (ctrl e)
  569.     6=9=move cursor forward one character (ctrl f)
  570.     11=clear buffer from cursor (ctrl k)
  571.     12=clear whole buffer (ctrl l)
  572.     21=clear buffer from mark (ctrl u)
  573.     28=set mark to current cursor offset
  574.     127=delete character before cursor
  575. When a command with string parameter is called, R0 points to the user
  576. editable part of the string.
  577.     \E R0=pointer to zero terminated string
  578.     
  579. Zap_MiniPrompt
  580. This replaces the prompt string in the minibuffer with the given string. It's
  581. main use is for reason code R2=6 when a command with string parameter is
  582. called (see E-Commands). The buffer is not updated on screen (see
  583. Zap_MiniWrite). Unlike Zap_MiniWrite, the minibuffer cursor is not affected
  584. by this call (It remains the same number of characters after the mark).
  585.     \E R0=new prompt string
  586.     
  587. Zap_MiniUpdate
  588. This call updates the minibuffer on screen (if open). This will usually be
  589. done automatically by Zap.
  590.  
  591. Zap_AddYankRegion
  592. This call adds a region to the cut/paste kill ring. The region you pass it
  593. is not copied so must be stable (eg in a heap block).
  594.     \E R0=address of region + flags:
  595.         b31 MUST BE SET (If clear then denotes an undo buffer ref).
  596.         b30 If set, then after yanking this block, it will move onto
  597.             the block before (ie, yanks many blocks at once).
  598.        R1=block length (provided b31 of R0 is set).
  599.  
  600. Zap_FindCommand
  601. This call converts a command name into a command address by looking it up
  602. in Zaps command tables. If the command is in an extension module then that
  603. module is loaded as well.
  604.     \E R0=command name terminated by <=32 or :,&,"
  605.     \X R0=command address / 0 if not found
  606.     
  607. Zap_ProcessCommand (see also Zap_CommandString).
  608.  This makes a call to a Zap command. It should be used for all calls to
  609. commands. You can find the address of a command via Zap_FindCommand. You
  610. may also call commands which may not have a name - it just considers the
  611. command address.
  612.  The data the command takes is pointed to in R0. The data format depends on
  613. the command. It should point to a list of bytes/word or a string depending on
  614. whether the command takes a byte/word or string parameter. It is undefined if
  615. the command takes no parameter. See E-Commands for more details. Put R0=0
  616. instead of the pointer to a string to open the minibuffer instead.
  617.  The number of times the key has 'auto-repeated' is passed in R1. This will
  618. be the length of the byte/word list if the command takes byte or word
  619. parameters. Usually put R1=1.
  620.  R2 holds the action code of the command. Action code 0 executes the command.
  621. The other action codes are used to read information about the command and are
  622. mainly used internally by Zap. See E-Commands for the details.
  623.  NB The mode e_aligncaret entry point will be called before all command calls
  624. using R2=0,1 on entry.
  625.  \E R0=pointer to command data (0 if there is no data)
  626.        R1=length of the command data if byte or word list (in bytes or
  627.           words). Number of times key has auto-repeated otherwise.
  628.        R2=Command action code:
  629.            b0-b27 = Action code to be passed to the command. 0 to
  630.                 execute it - see E-Command.
  631.            b28-b31= Flags to tell Zap_ProcessCommand things. These are
  632.                 filtered out before R2 is passed to the command.
  633.                 b31=Set if command should not be learnt even
  634.                     if in learn mode.
  635.              b30-b28 reserved.
  636.        R7=command address (need not point to a command registered in a
  637.                command table, but must conform to the specs in the
  638.                file E-Command. Eg, [R7,#-4] must be the flags word).
  639.        R8=window block pointer or 0 if none applicable (options menu)
  640.        R9=file block pointer or 0 if none applicable (options menu)
  641.        R10=input cursor (or cursor you wish command to act on) or 0
  642.            if not applicable.
  643.  \X R1-R13 preserved.
  644.     If action code=0 on entry then R0=0 or -1 if minibuffer opened.
  645.     If action code>0 on entry then R0=value in R0 when command returned.
  646.  
  647. Zap_FindKeyEntry
  648. This finds the entry corresponding to a given key and keymap. You might use
  649. it for redefining the key for instance. The block pointed to on exit has the
  650. format:
  651.     #0 Command address (or 0 if none - key is passed on to wimp)
  652.        (The module containing the command is loaded if necessary).
  653.     #4 Command parameter, this depends on the command flags b3-7. If
  654.        these bits are:
  655.        0   => #4 undefined (should be 0)
  656.        1/2 => #4 is the byte or word to be added to the list to be
  657.              passed to the command when the key is pressed.
  658.        3   => #4=address of string parameter /0 if minibuffer should be
  659.               used.
  660.        4   => #4=address of the data block.
  661.     \E R0=keymap number R1=zaps key number (0-&1FF)
  662.     \X R0=entry for this key / 0 if keymap does not exist or key is
  663.        out of range.
  664.  
  665. Zap_FindLeafName
  666. This works out which part of a filename is the leafname.
  667.     \E R0=filename pointer
  668.     \X R0=pointer to the leafname part (within the filename).
  669.  
  670. Zap_NewFileName
  671. Change the name of a given file. You may have to call Zap_NewFileTitle to
  672. update the titlebars (this will usually be done by Zap_SaveFile).
  673.     \E R0=new file name R9
  674.     
  675. Zap_CheckFileName
  676. Decides whether a filename is a full path name (eg "ADFS::$.Wibble") or just
  677. the leaf name of a file (eg "Text1"). Should be used in conjunction with
  678. Zap_SaveFile as this will not save files without full path names.
  679.     \E R0=filename
  680.     \X R0=0 if it is a full path name / 1 otherwise
  681.  
  682. Zap_GetCurrDir
  683. Returns current directory (of the temporary filing system) which should be
  684. used as default string in minibuffer file operations. On RISC OS 2, there is
  685. no way of reading the current directory so this call returns the root
  686. directory on the current disc (via OS_Args 0, OS_FSControl 33, OS_GBPB 5). On
  687. RISC OS 3, the current directory is read via OS_Args 0, OS_FSControl 33, and
  688. OS_FSControl 54. NB The block it is returned in is not stable over calls to
  689. Zap. You may call Zap_MiniWrite passing this block but should copy the
  690. string for other calls.
  691.     \X R0=pointer to 256 byte buffer containing the directory name
  692.  
  693. Zap_MiniWriteC
  694. Writes a single character to the minibuffer. See Zap_MiniWrite for the
  695. character codes.
  696.     \E R0=character to insert in minibuffer.
  697.  
  698. Zap_MiniClear
  699. Clears minibuffer contents without updating on screen. Resets marks etc. You
  700. should use this before using Zap_MiniStart.
  701.  
  702. Zap_MiniStart
  703. This starts up the minibuffer. Do not use this call when writing a Zap
  704. command. Read the file E-Command to see how the minibuffer works in this
  705. case. You never need this call, Zap_ProcessCommand can open a minibuffer at
  706. any time if you feed it a string type command and R0=R2=0.
  707.     \E R7=address of command to be called when return pressed in
  708.        minibuffer. [R7,#-4] must contain the command flags word as
  709.        documented in E-Command.
  710.        R8/R9=window minibuffer should appear at.
  711.  
  712. Zap_MiniEval
  713. This turns a string into a number via OS_EvaluateExpression. It is usually
  714. called near the start of a command which expects to find a number in the
  715. minibuffer.
  716.     \E R0=string pointer (usually minibuffer pointer passed to you)
  717.     \X R0=number stored in string/CS if not a valid number.
  718.  
  719. Zap_CommandString (see also Zap_ProcessCommand)
  720. This call takes a command (or colon separated list of commands) in string
  721. form and executes them as typed. For example if R0="MODE 0" on entry then
  722. first of all a call to Zap_FindCommand will be made to find the address of
  723. the command "MODE" and then the command will be called via
  724. Zap_ProcessCommand with R2=0.
  725.     \E R0=command string (zero terminated)
  726.           Set b31 if you don't want the commands to be learnt if in
  727.           learn mode.
  728.     \X R0=0 or -1 if the minibuffer has been opened.
  729.  
  730. Zap_ProcessKeys
  731. This entry point accesses Zap's main key handling sub so you can simulate
  732. keypresses. If you just wish to simulate one key press, then it is easier to
  733. use the next call. This call is for multiple keypresses and buffers the data
  734. as much as possible before it has to call a command. You must keep calling
  735. this command until it returns R0<0 (as it will do if you put R5=-1 on entry -
  736. it uses the R5=-1 call to execute the buffered data).
  737.     \E R0=zap key number of next key to execute (if R5>=0)
  738.        R5=-1     => there are no more keys to buffer (R0 not defined).
  739.           0-&1FF => wimp key number of key to send to Wimp_ProcessKey
  740.                if no command is attached to the key.
  741.           &200   =>    if Wimp_ProcessKey should never be called.
  742.        R6=length of current buffering (set to 0 on first call)
  743.        R7=command currently being buffered (if R6>0)
  744.        R8-R10=input cursor
  745.     \X R0>=0 if you should call this sub again with the next key (or
  746.           R5=-1 if there are no more).
  747.        R0<0 if the command has finished processing all buffered data
  748.           so you needn't call it again.
  749.        R6/R7 are updated for the next call.
  750.        
  751. Zap_ProcessAKey
  752. This command simulates a key press by calling the above command twice, once
  753. with the key and then once with R5=-1.
  754.     \E R0=zap key number
  755.        R5=wimp key number (see Zap_ProcessKeys)
  756.        R8-R10=input caret
  757.  
  758. Zap_OpenWindow
  759. The current position of a Zap window can be read easily using the code:
  760.  MOV R1,R8 : SWI "XWimp_GetWindowState". However, you should not call
  761. Wimp_OpenWindow to open a window as Zap has to keep track of the title length
  762. and position of the minibuffer etc. You should use this call instead. Use
  763. call 0 where possible as it prevents titlebar flicker.
  764.     \E R0=type of open:
  765.         0 => Just changing scroll offsets or height in window stack.
  766.              Size/position of window NOT changing.
  767.         1 => Window may move/change size. Minibuffer, title bar
  768.              and cursors dealt with accordingly.
  769.         2 => Window is a new window. Toggle size data etc reset.
  770.         3 => Bring window to front of stack (ignore R1)
  771.         4 => Put window to back of stack (ignore R1)
  772.         5 => As for 0, but cursor kept within the window if the
  773.              'constrict cursor' option is on.
  774.         (NB type 2 calls type 1 calls type 5 calls type 0)
  775.        R1=open block (as for Wimp_OpenWindow)
  776.        R8=window block (NB Usually alter this block and let R1=R8)
  777.  
  778. Zap_RestoreModeWord
  779. This call should be used by your e_start entry point. If R8<>0 on entry then
  780. it reads the reads the options for the given mode from w_datablock using the
  781. call Zap_ModeData, and sets them as the current options. If R8=0 then it does
  782. the same thing but sets the default options.
  783.     \E R0=mode number
  784.        R8=window to restore options on / 0 for the default options.
  785.        
  786. Zap_SaveModeWord
  787. This call should be used by your e_end entry point. If R8<>0 on entry then it
  788. reads the words w_flags and w_format and stores the current options in the
  789. w_modedata block by use of the call Zap_ModeData. If R8=0 on entry then it
  790. reads opt_flags and opt_format and stores them as the default option etc.
  791.     \E R0=mode number
  792.        R8=window to save options on / 0 for the default options.
  793.  
  794. Zap_GetModeWord
  795. This call reads the contents of your mode word. If R8=0 then it reads
  796. opt_moden, otherwise it reads [R8,#w_moden]. This is useful for menu
  797. options.
  798.     \E R1=mode number
  799.        R8=window to get mode word / 0 for default options mode word
  800.     \X R0=mode word contents.
  801.     
  802. Zap_PutModeWord
  803. As above, but write the value.
  804.     \E R0=new value for the word
  805.        R1=mode number
  806.            R8=window to put mode word / 0 for default options mode word
  807.  
  808. Zap_BaseMode
  809. This call replaces Zap_CallBaseMode. It differs in that you must specify
  810. which mode is calling. This information is not necessarily available from
  811. the block in R8 if another mode is based on yours. The basemode of the mode
  812. named in R9 is called via the entry point offset given in R11. Before the
  813. entry point is actually called, R9 is converted to the file block pointer
  814. of the window specified in R8. Hence any entry point requiring R8 and R9
  815. set up on entry can be called ok.
  816.     \E R0-R7=parameters for the call
  817.        R8=window block to be used by the call.
  818.        R9=mode number making this call (your mode number).
  819.        R10=parameter for the call (usually cursor block pointer).
  820.        R11=mode entry point offset (see E-Entry) to call.
  821.     \X As for the given mode entry point.
  822.  
  823. Zap_ReadWord
  824. This call can be used for reading 4 byte from a file buffer. Note that
  825. although the offset of the word in the file may be word aligned, it's offset
  826. in the buffer may not be due to the split. This call reverses the word if the
  827. Big Endian flag is set.
  828.     \E R0=File offset of the word to be read
  829.        R8=window (for big endian flag to be read)
  830.        R9=file
  831.     \X R0=the word read (padded with zeros if it went off the file end).
  832.  
  833. Zap_ReplaceWord
  834. This call replaces a word at the given file offset (inserting if the file
  835. offset+4>file length) via Zap_Command. The word is reversed if the big endian
  836. flag is set.
  837.     \E R0=word to replace
  838.        R1=file offset
  839.        R8/R9 (R8 used for the big endian flag).
  840.  
  841. Zap_ModeColour
  842. This call reads or writes the colour definition table. It will not usually
  843. have immediate effect unless you recreate the window (eg Zap_NewWinStatus).
  844. You shouldn't usually access this data as Zap handles it all for you, except
  845. to write sensible default values (using R8=0) if your mode starts up and
  846. finds its mode word is zero.
  847.     \E R0=colour to write:
  848.           -1   => Don't write anything (just read the value)
  849.           b0-b7 <16 => Write this wimp colour (converting it to RGB)
  850.           b0-b7 >15 => Write 24 bit colour of the form &BBGGRRZZ
  851.                where ZZ is the Zap style (&10=base style)
  852.        R1=mode number
  853.        R2=Zap colour number of the colour to write/read:
  854.           0/1=Background 2=Foreground 3=Selection background
  855.           4=selection foreground 5=cursor back 6=cursor for
  856.           7=line numbers 8=control chars
  857.           9+ mode dependent extension colours.
  858.        R8=Window block to read from / 0 for default (!Config) settings.
  859.     \X R0=colour value read / old value if writing it. This is of the
  860.           form &BBGGRRZZ as above.
  861.  
  862. Zap_FindInput
  863. This call works out the current position of the 'input focus' in a window. If
  864. the input caret is in this window then it returns it's offset. Otherwise it
  865. returns the 'point' position (usually marked by an empty square).
  866.     \E R8/R9
  867.     \X R0=most suitable offset to insert data.
  868.  
  869. Zap_ClipCache
  870. This call moves the cache reference point (w_cline/coff/clogl etc) to a given
  871. point (using e_clnoff).
  872.     \E R0=Offset in line to move the cache reference point to. R8/R9
  873.  
  874. Zap_ModeData
  875. This call reads or write the mode dependant options that Zap handles
  876. automatically for you. See also Zap_ModeColour. Currently there is only one
  877. word per mode storing the width and things like whether auto-indent is on or
  878. not. You should use this call with R8=0 to write sensible default values if
  879. your mode starts up and finds its mode word is zero. If you don't then the
  880. default Text mode values will be used.
  881.     \E R0=value to write / -1 to read
  882.        R1=mode number
  883.        R2=variable number to read write
  884.        R8=window concerned / 0 for the default (!Config) settings.
  885.     \X R0=variable value if read / old value if written
  886.     Variables num:    0     b0-b15  stores the "width" for this mode
  887.                 b16    auto indent bit (b16 of w_format)
  888.                 b17     auto width bit (b6 of w_flags)
  889.                 b18    strip spaces bit (b18 of w_format)
  890.                 b19-b21 tab mode bits (b9-b11 of w_flags)
  891.                     b19-b20 0=Unix 1=Edit 2=Coltab
  892.                     b21=insert tabs as spaces
  893.                 b22    hex entry mode bit (b5 of w_flags)
  894.                 b23    overwrite bit (b1 of w_flags)
  895.                 b24-b31    display bits (b8-b15 of w_format)
  896.                     b24=line numbers shown
  897.                     b25=line numbers as lines (not addr)
  898.                     b26=line numbers in hex
  899.                     b27=logical line nums (not physical)
  900.                     b28-29 0=no tabs 1=spaces 2=> 3=->
  901.                     b30=line edit paradigm
  902.                     b31=non standard editing
  903.             1+    reserved.
  904.  
  905. Zap_WhichMode
  906. This call decides which mode a given file should be displayed in.
  907.     \E R0=load address of file (containing the filetype)
  908.        R1=filename pointer / 0 if not known
  909.           b31=flag to determine the meaning of R10 on exit
  910.     \X R0=address of a data block of info about this file mode. 
  911.        R10=If b31 of R1 was clear on entry then this is the mode number
  912.            of the default mode the file is loaded into (the mode is
  913.            loaded if necessary). If is was set then this is a pointer
  914.            to the mode name (mode not necessarily loaded).
  915.  
  916. Zap_ModeNumber
  917. This calls turns a mode name (given by a string) into a mode number. The mode
  918. is loaded if not already resident in memory.
  919.     \E R0=mode name string terminated by <= space (&20)
  920.     \X R0=mode number or -1 if not found.
  921.  
  922. Zap_SendDataSave
  923. This call initiates the save protocol, saving data to another window or
  924. application via RAM transfer or WimpScrap. It sends the data_save message and
  925. all replies are handled automatically.
  926.     \E R2=proposed file/leaf name of the data (or 0 to use the file's)
  927.        R3=destination window handle or task handle
  928.        R4=destination icon handle (if R3=-2)
  929.        R5/R6=destination mouse coords (if applicable)
  930.        R7=routine to call after save finished (or 0 if none).
  931.        R8/R9=R8<>0 => Save whole file R8=window block R9=file block
  932.             R8=0  => Save currently selected region.
  933.             (or set b1 of R10 to save an arbitrary region).
  934.        R10=b0-b15 flags:
  935.            b0 set => External edit flag. In this case R3=ext edit
  936.                 job handle and R4=ext edit task handle and
  937.                 external edit message sent instead.
  938.            b1 set => R8=start address of data to save
  939.                     R9=size of the data to save
  940.                     b12-b31 of R10=filetype of data to save.
  941.            b16-b31 = extra data (see b1)
  942.        R11=data to pass to routine in R7 (if used).
  943.     \X Data transfer protocol initiated.
  944.     Sub pointed to by R7 is called with R11 as passed above and should
  945.     preserve R1+ as usual.
  946.  
  947. Zap_Warning
  948. Warns the user without generating an error. This opens a window with the
  949. given message and pauses for the message to be seen before returning. Wimp
  950. Poll is not called.
  951.     \E R0=warning message
  952.        R1=time to leave message open in cs (0 for default delay)
  953.           + flags:
  954.            b31 => Don't beep when opening the window
  955.        R8/R9=window in which to show the warning.
  956.  
  957. Zap_AllWindow
  958. Calls a given subroutine once for each valid Zap window. See also
  959. Zap_EachWindow.
  960.     \E R0-R7=arguments to pass to the sub
  961.        R10=address of the sub to call (which must preserve all registers
  962.            except R0, and is called once for each window with R8/R9
  963.            set up to be that window).
  964.  
  965. Zap_ReadMenu
  966. Converts a text file of the same format of Zap's 'Menu' file into a Zap menu
  967. structure.
  968.     \E R0=start of a zero terminated menu text file (stored in memory)
  969.     \X R0=pointer to heap block containing the following information
  970.         #0 Number of valid menu handles for this file (first
  971.            number appearing in the file)
  972.         #4 Pointer to the menu structure (in Zap-Wimp format) for
  973.            handle 0 (or 0 if handle 0 not used)
  974.         #8 Pointer to structure for handle 1
  975.         #12 Pointer to structure for handle 2 etc.
  976.  
  977. Zap_LoadMenu
  978. Converts a text menu file to a Zap menu structure.
  979.     \E R0=pointer to filename of the menu file
  980.     \X R0=list of menu handles as for Zap_ReadMenu
  981.     
  982. Zap_OpenMenu
  983. Opens a menu on the screen. The menu structure is handled automatically once
  984. it has been opened.
  985.     \E R1=pointer to Zap-Wimp menu structure
  986.        R2=mouse x to open at
  987.        R3=mouse y to open at
  988.        R8/R9=window the menu is being opened on or 0's for none (eg the
  989.          iconbar menu).
  990.  
  991. Zap_CallBack
  992. Schedules a subroutine to be called again at a certain time but using wimp
  993. null events.
  994.     \E R1=(earliest) monotonic time to call back at (>0)
  995.           or -(smallest delay before calling back) =< 0.
  996.        R2=address of routine to call.
  997.        R3=data to pass to the routine in R11.
  998.     The routine pointed to by R2 has conditions:
  999.      \E R1=current time R11=value passed in R3
  1000.      \X (must save R1+ as usual)
  1001.  
  1002. Zap_DragBox
  1003. Starts a wimp drag box making sure you get called when it's finished.
  1004.     \E R0=b0 set if you wish to be called repeatedly during the drag
  1005.           b1+ reserved (set to 0)
  1006.        R1=drag box block to be passed to Wimp_DragBox
  1007.        R2=address of routine to call.
  1008.        R3=data to pass to the routine in R11.
  1009.     The routine pointed to by R2 has conditions:
  1010.      \E R0=reason code 1=drag in progress 2=drag has just finished
  1011.         R1=drag box posn as returned by wimp if R0=2
  1012.         R11=value passed in R3
  1013.      \X (must save R1+ as usual)
  1014.      
  1015. Zap_SendMessage
  1016. Sends a wimp message and logs the message number (my_ref) so that any reply
  1017. can be forwarded to you. The message reference is held for at least a minute
  1018. and only deleted on a null event.
  1019.  E R0=b0-b27 message action number (to go in R1,#16)
  1020.       b28    set if you are interested in the reply.
  1021.       b29    set if you want to be called when message deleted
  1022.       b30-31 00 => Just send the message (with code 17)
  1023.           01 => Just acknowledge the message (with code 19)
  1024.           10 => Send the message recorded (with code 18) and call the
  1025.             reply code if the message replied to.
  1026.           11 => Send the message recorded (with code 18) and call the
  1027.             reply code if the message replied to or bounces.
  1028.    R1=message block
  1029.    R2=dest task handle/window handle
  1030.    R3=b31 clear => This is the message length (is rounded up to next word)
  1031.       b31 set   => This is the offset of a string ending the message.
  1032.    R4=icon handle if R2=-2 (iconbar) [not used otherwise]
  1033.    R5=address of routine to call when message replied to [if b28 of R0]
  1034.       (zero as a value means that you want any replies to be dealt with
  1035.        as if they were normal messages and not a reply)
  1036.    R6=private word to pass to routine on a reply [if b28 of R0]
  1037.  X The message is sent as an original message. Hence the my_ref, length
  1038.    and message action fields are filled in for you. R0=task handle of the
  1039.    dest task (R2 on exit from Wimp_SendMessage)
  1040.      Routine in R5 called with:
  1041.          ;E R0=message type
  1042.              0 => message being removed from log list (see b29)
  1043.              17 => message replied to as normal
  1044.              19 => message bounced
  1045.             R1=message block
  1046.             R2=message number (R1!16) R11=private word R12=Zap's etc
  1047.          ;X You can corrupt R0-R11 if R0=17,19
  1048.             You should save R1-R11 if R0=0
  1049.  
  1050. Zap_Reply
  1051. Replies to a message. It copies my_ref to your_ref for you can reads the task
  1052. handle of the task to reply to from the message block. The length word is
  1053. assumed to be unchanged.
  1054.  E R0=message action number (as for SendMessage)
  1055.    R1=message block (with ref etc)
  1056.    R5/R6=routine to handle the reply if b28 of R0 (as for SendMessage)
  1057.  
  1058. Zap_Extend
  1059. Changes the size of a heap block, making it smaller or bigger as for OS_Heap
  1060. with the extend action code.
  1061.  \E R0=pointer to the heap block R1=signed change in the size
  1062.  \X R0=new heap block pointer (it may have moved)
  1063.  
  1064. Zap_ModeColourNum
  1065. Reads/writes the size of the colour palette used by a given mode. Maximum
  1066. size of a palette is currently 256 colours. Use R8=0 to read the default
  1067. values. NB If you enlarge the palette then please write some sensible values
  1068. for the new entries!
  1069.  \E R0=new size of palette (in number of colours) / -1 to read
  1070.     R1=mode number R8/R9=window or R8=0 for the default options.
  1071.  \X R0=old size / read size.
  1072.  
  1073. Zap_CreateThrowback
  1074. Creates a throwback buffer ready for lines being inserted by Zap_Throwback.
  1075.  ;E R0=suggested width of window / 0 to use default width
  1076.  ;X R0=window offset of window R8/R9=newly created throwback window
  1077.  
  1078. Zap_Throwback
  1079. Inserts a line in a throwback file for you.
  1080.  \E R0=file offset or line number of line with info on it
  1081.        set b31 to suppress this being printed automatically.
  1082.     R1=filename (of the file that R0 is an offset in)
  1083.     R2=information string to print after the line number (eg "Bad syntax")
  1084.     R3=string to precede filename  (eg "Errors in file:")
  1085.     R4=file offset of linked file / -1 if may not be loaded
  1086.     R5=flags to use for the new entry (see f_links,#12)
  1087.     R6=string to precede new info block (eg "Line num  Error")
  1088.     R7=string to go after filename (eg 10,"Search string: fred")
  1089.     R8/R9=throwback window to add entry to
  1090.  \X Throwback entry added and new title block given if file (or flags)
  1091.     have changed KB #
  1092.     The line number field is 10 characters wide if not suppressed.
  1093.